﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DesignPatterns
{
    abstract class AbstractMethod
    {
        public void TestMethod()
        {
            Console.WriteLine("开始....");

            One();

            Console.WriteLine("结束...");
        }

        protected abstract void One();

    }

    class Class1 : AbstractMethod
    {
        protected override void One()
        {
            Console.WriteLine("this is class1");
        }
    }

    class Class2 : AbstractMethod
    {
        protected override void One()
        {
            Console.WriteLine("this is class2");
        }
    }

}
